package com.example.music;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.example.music.Utils.songListAdapter;
import com.example.music.Utils.songListItem;

import java.util.ArrayList;
import java.util.List;

public class profileSongDietsActivity extends AppCompatActivity {
    private ImageView home_btn;
    private ImageView profile_btn;
    private ImageView home_search;
    private ImageView center_btn;
    public void init(){
        home_btn = findViewById(R.id.home_btn);
        profile_btn = findViewById(R.id.profile_btn);
        home_search = findViewById(R.id.home_search);
        center_btn = findViewById(R.id.center_btn);
    }
    public void initListener(){
        //点击进入主页
        home_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                jumpTo(HomeActivity.class);
            }
        });
        profile_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                jumpTo(ProfileActivity.class);
            }
        });
        home_search.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                jumpTo(HomeActivity.class);
            }
        });
        center_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                jumpTo(MainActivity.class);
            }
        });
    }
    public void initRecycleView(){
        //歌曲
        RecyclerView SongRecyclerView = findViewById(R.id.SongRecyclerView);
        RecyclerView.LayoutManager layoutManager2 = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        SongRecyclerView.setLayoutManager(layoutManager2);

        List<songListItem> yourDataSource2 = new ArrayList<>();
        songListItem item = new songListItem("item1","1",true,true);
        yourDataSource2.add(item);
        yourDataSource2.add(item);
        yourDataSource2.add(item);
        yourDataSource2.add(item);
        yourDataSource2.add(item);

        songListAdapter adapter2 = new songListAdapter(this,yourDataSource2);
        SongRecyclerView.setAdapter(adapter2);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile_song_history);

        init();
        initListener();
        initRecycleView();
    }
    public void jumpTo(Class context){
        Intent intent = new Intent(profileSongDietsActivity.this, context);
        startActivity(intent);
    }
}